package com.lwj.project1;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.PagerAdapter;

import java.util.ArrayList;

public class MyPagerAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> list;


    MyPagerAdapter(@NonNull FragmentManager fragmentManager,ArrayList<Fragment> list){
        super(fragmentManager);
        this.list = list;
    }

    @NonNull
    public Fragment getItem(int position){
        return list == null ? null :list.get(position);
    }
    @Override
    public int getCount() {
        return list == null ? 0:list.size();
    }
}
